package com.kingdee.eas.fdc.invite.news.client;

import java.util.HashMap;
import java.util.Map;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.ctrl.reportone.r1.print.data.R1PrintDataSource;
import com.kingdee.bos.dao.query.IQueryExecutor;
import com.kingdee.bos.dao.query.QueryExecutorFactory;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.MetaDataPK;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.eas.fdc.basedata.util.FDCNoteDataProvider;
import com.kingdee.jdbc.rowset.IRowSet;

public class StrategyPactDataProvider extends FDCNoteDataProvider {

	private Map dataMap = new HashMap();
	private String billId = null;

	public StrategyPactDataProvider(String billId, IMetaDataPK mainQuery) {
		super(billId, mainQuery);
		this.billId = billId;
	}
	
	public IRowSet getOtherSubRowSet(R1PrintDataSource ds) throws Exception {
		if("PrintStrategyPactQuery".equalsIgnoreCase(ds.getId())){
			IRowSet iRowSet = null;
			try {
				IQueryExecutor exec = QueryExecutorFactory.getRemoteInstance(new MetaDataPK("com.kingdee.eas.fdc.invite.news.PrintStrategyPactQuery"));
				exec.option().isAutoTranslateEnum = true;
				EntityViewInfo ev = new EntityViewInfo();
				FilterInfo filter = new FilterInfo();
				filter.getFilterItems().add(new FilterItemInfo("id", billId, CompareType.EQUALS));
				ev.setFilter(filter);
				exec.setObjectView(ev);
				iRowSet = exec.executeQuery();
			} catch (Exception e) {
				throw new BOSException(e);
			}

			return iRowSet;
		}
		return getMainBillRowSet(ds);
	}
}
